
package au.com.lastweekend.jim.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JOptionPane;

import au.com.lastweekend.jim.controller.ImageSearchController;
import au.com.lastweekend.jim.swing.SwingUtil;

public class ImageSearchAction extends AbstractAction {

    private static final long serialVersionUID = 1L;

    private ImageSearchController controller;

    public ImageSearchAction(ImageSearchController controller) {

        super("Search");
        this.controller = controller;
        SwingUtil.setActionParameters(this, "find.png", "Search", "Search for images");
        putValue(SwingUtil.TOOLBAR, Boolean.TRUE);
        putValue(SwingUtil.MENU, "File");

    }

    public void actionPerformed(ActionEvent e) {

        String searchString = JOptionPane.showInputDialog("Search:");
        controller.search(searchString);
    }

}
